package net.dreamlu.qa.interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.core.ActionInvocation;
import com.jfinal.kit.StringKit;

/**
 * 对搜索q为空的拦截
 * @author chunmeng.lu
 *
 */
public class SearchInterceptor implements Interceptor {
	public void intercept(ActionInvocation ai) {
		if(StringKit.isBlank(ai.getController().getPara("q"))){
			ai.getController().redirect("index");
		}else {
			ai.invoke();
		}
	}
}